package com.example.tanwei.service;

import com.example.tanwei.mapper.UserMapper;
import com.example.tanwei.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * @Author: huang
 */

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;


    public List<User> getUsers() {
        return userMapper.getUsers();
    }

    public User getUserById(int id) {
        return userMapper.getUserById(id);
    }

    public int addUser(User user){
        return userMapper.addUser(user);
    }

    @Transactional
    public int deleteUserById(int id) {
        return userMapper.deleteUserById(id);
    }
}
